package com.fc.entities

import javax.persistence.Column
import javax.persistence.Entity
import javax.persistence.ManyToOne
import javax.persistence.Table
import javax.validation.constraints.Min
import javax.validation.constraints.NotNull
import javax.validation.constraints.Size

@Entity
@Table(name = "Activity")
class Activity extends BaseEntity {
	@Column(name = "name", unique = true)
	@NotNull
	@Size(min=4, max=64)
	String name
	
	@Column(name = "minutes")
	@Min(1L)
	int minutes
	
	@Column(name = "burntCalories")
	@Min(1L)
	int burntCalories
	
	@ManyToOne
	ActivityGroup activityGroup
	
	@ManyToOne
	User user
	
	@Column(name = "description", length = 12000)
	@NotNull
	@Size(max = 40000)
	String description
	
	@Override
	String toString() {
		return name
	}
}
